//
//  WPRegisterViewModel.m
//  ZhongChouPingTai
//
//  Created by WeiPan on 16/4/8.
//  Copyright © 2016年 HuaYiSoftware. All rights reserved.
//

#import "WPRegisterViewModel.h"

@implementation WPRegisterViewModel
+ (void)registerWithPhone:(NSString *)phone andWithCode:(NSString *)code andWithPwd:(NSString *)pwd andSuccessBlock:(void (^)(NSString *))succ andFailureBlock:(void (^)(NSString *))fail {
    NSDictionary * params = @{@"mobile":phone,
                              @"captcha":code,
                              @"pwd":pwd};
    [NetWorkingManager postWithUrl:@"wjs_platform/moveSoftware/register.jhtml" requestParams:[NetWorkingManager paramsByAppendingUserInfo:params] SuccessHandler:^(id responseObject) {
        if (responseObject) {
            if (responseObject[@"resultType"] && [responseObject[@"resultType"] intValue]) {
                succ(@"注册成功");
            } else {
                fail(responseObject[@"resultMsg"] ? responseObject[@"resultMsg"]:@"网络数据错误");
            }
        } else {
            fail(@"网络数据错误");
        }
    } failureHandler:^(NSError *error) {
        fail(error.localizedDescription);
    }];
}
@end
